<?php

include "../lib/DAL/DonViHocVu.php";

class DonViHocVuBLL {

    function __construct() {
        
    }

    function __destruct() {
        
    }

    function setDonViHocVuBLL($row) {
        $dvhv = new DonViHocVu();
        $dvhv->setDonViHocVu($row['kyhoc'], $row['ma_donvihocvu'], $row['namhoc'], $row['ngaybd'], $row['ngaykt']);
        return $dvhv;
    }

    public function getDonViHocVu($ma_dvhv) {
        $sql = "select * from tbl_donvihocvu where ma_donvihocvu ='" . $ma_dvhv . "'";
        $row = mysql_fetch_array(mysql_query($sql));
        return $this->setDonViHocVuBLL($row);
    }

    public function getListDonViHocVu() {
        $arr_dvhv = array();
        $result = mysql_query("select * from tbl_donvihocvu");
        while ($row = mysql_fetch_array($result)) {
            $arr_dvhv[] = $this->setDonViHocVuBLL($row);
        }
        return $arr_dvhv;
    }

}

?>